<template>
	<view class="Schedule_main">
		<view class="flex jcsb aic" style="margin-bottom: 10px;">
			<p class="fonts14 fontz ">{{object.positionName}}</p>
			<p class="fonts12 fontz " v-if="header==1">岗位-笔试通知</p>
			<p class="fonts12 fontz " v-if="header==2">面试</p>
			<p class="fonts12 fontz " v-if="header==3&&obj.status==5">体检报告</p>
			<p class="fonts12 fontz " v-if="header==3&&obj.status==6">背景调查</p>
			<p class="fonts12 fontz " v-if="header==3&&obj.status==7">录用通知/公示</p>
		</view>
		<view class="">
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;">公司名称：{{object.tenantVo.companyName}}</p>
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;" v-if="header==1">笔试时间：{{obj.writingTestingTime}}</p>
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;" v-if="header==2&&obj.interviewDate">面试时间：{{obj.interviewDate}}</p>
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;" v-if="header==2&&obj.interviewDate">面试方式：{{dictFuns(obj.interviewType,"interview_type")}}</p>
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;" v-if="header==2&&obj.interviewDate">面试地点：{{obj.interviewLocation}}</p>
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;" v-if="header==4">入职时间：{{obj.onBoardingTime}}</p>
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;" v-if="header==4">入职地点：{{obj.onBoardingLocation}}</p>
			<p class="fonts12 fontz gray" style="margin-bottom: 7px;" v-if="header==2&&obj.interviewDate">备注：{{obj.interviewNotice}}</p>
		</view>
		<view class="Schedule_main_btn flex jcsb aic">
			<view class="flex aic">
				<el-button class="" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="danger" v-if="header==1&&obj.writingTestingStatus == 1"
					@click="getup()">放弃笔试</el-button>
				<el-button class="blue_btn" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="primary"
					v-if="header==1&&obj.writingTestingStatus == 1" @click="request()">确定参加</el-button>
					<el-button class="blue_btn" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="primary"
						v-if="header==1&&obj.writingTestingStatus == 2" >已确定参加</el-button>
				<!-- <el-button class="" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="danger" v-if="header==2">
					放弃面试</el-button>
				<el-button class="blue_btn" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="primary"
					v-if="header==2">确定参加</el-button> -->
				<el-button class="blue_btn" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="primary" v-if="header==3"  @click="detail()">体检报告</el-button>
				<el-button class="" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="info" v-if="header==1&&obj.writingTestingStatus == '-1'">已放弃笔试</el-button>
				<!-- <el-button class="" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="info">已放弃入职</el-button>
				<el-button class="" style="width: 100%;border-radius: 8px 8px 8px 8px;" type="info">已放弃面试</el-button> -->
			</view>
			<view class="flex aic">
				<text class="fonts12 fontz gray" @click="detail()">查看详情</text>
				<image src="@/static/icon／arrow-right.png" style="width: 20px;height: 20px;" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		dictFun
	} from "@/util/dictionary"
	export default {
		props: ["data", "header"],
		data() {
			return {
				object: {
					tenantVo:{
						companyName:""
					}
				},
				obj:{}
			}
		},
		watch: {
			data: {
				handler(newVal, oldVal) {
					this.obj=newVal
					this.object = newVal.recruitmentPositionVo
					console.log("onject:",this.obj);
					console.log("onject:",this.object);
				},
				deep: true,
				immediate:true
			},
		},
		methods: {
			dictFuns(value, res) {
				// console.log(value, res);
				return dictFun(value, res)
			},
			getup() {
				let params = {
					id: this.obj.id,
					writingTestingStatus: "-1"
				}
				this.$emit("scheduleClick", params)
			},
			request() {
				let params = {
					id: this.obj.id,
					writingTestingStatus: 2
				}
				this.$emit("scheduleClick", params)
			},
			detail(item) {
				uni.navigateTo({
					url: "/pages/index/position/position?data=" + JSON.stringify(this.object)
				})
			},
			uploadClick(){
				uni.navigateTo({
					url: "/pages/index/position/report/report?data=" + JSON.stringify(this.object)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.Schedule_main {
		width: calc(100% - 28px);
		padding: 14px;
		background: #FFFFFF;
	}

	.blue_btn {
		background: #2F6CBC;
		border: 1px solid #2F6CBC;
	}

	.Schedule_main_btn {
		margin-top: 7px;
		border-top: 1px solid #D8D8D8;
		padding-top: 15px;
	}
</style>
